/*
 *  policy - Part of the Policy Server Application
 *  Copyright (C) 2009 Liam Lowey
 *  
 *      http://policyserver.turnitin.co.uk/
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  you may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at 
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0 
 *  
 *  Unless required by applicable law or agreed to in writing, software 
 *  distributed under the License is distributed on an "AS IS" BASIS, 
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 *  See the License for the specific language governing permissions and 
 *  limitations under the License. 
 */

using System;

namespace policyserver
{
  public sealed class TimeMath
  {
    public static readonly long NANOS_IN_A_TICK = 100;
    public static readonly long NANOS_IN_A_SEC = 1000000000;
    public static readonly long MICROS_IN_A_SEC = 1000000;
    public static readonly long TICKS_IN_A_SEC = NANOS_IN_A_SEC / NANOS_IN_A_TICK;
    public static readonly long TICKS_IN_A_MILLI = TICKS_IN_A_SEC / 1000;


    public static long millisToTicks( long ms )
    {
      return ms * TICKS_IN_A_MILLI;
    }


    public static TimeSpan spanFromMillis( long ms )
    {
      return new TimeSpan( millisToTicks( ms ) );
    }


    private TimeMath()
    {
    }
  }
}
